package org.qrd.openmayyam;

import java.io.IOException;
import java.util.Properties;

/**
 * Created by IntelliJ IDEA.
 * User: developer
 * Date: Feb 24, 2009
 * Time: 6:34:12 PM
 * To change this template use File | Settings | File Templates.
 */
public class ServerConfiguration {

    //TODO: add all required attributes in server configuration properties file
    //TODO: change properties forl to XML file
    public Properties serverProperties;
    private static ServerConfiguration serverConfiguration= new ServerConfiguration();

    private ServerConfiguration() {
        serverProperties = new Properties();
        try {
            serverProperties.load(this.getClass().getResourceAsStream("server.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    //singleton Pattern for retreving server configuration
    public static ServerConfiguration getServerConfiguration() {
        // not required since class is instansiated in Static block itself
        /*if (serverConfiguration == null) {
            serverConfiguration = new ServerConfiguration();
        } */
        return serverConfiguration;
    }
}
